#include "RenderPointComponent.h"
#include "../../Physics/ParticleComponent.h"
#include "../GameObject.h"
#include <Windows.h>
#include <gl/gl.h>
#include <gl/glu.h>

#define DEBUG_DRAWING

using namespace Pantsu;

RenderPointComponent::RenderPointComponent() {
}

RenderPointComponent::~RenderPointComponent() {
}

void RenderPointComponent::Update( float i_deltaTime ) {

	glPointSize( 3.0f );
	glBegin( GL_POINTS );
	glColor3f( 0.0f, 1.0f, 1.0f );
	glVertex3f( GetOwner()->GetTransform().GetPosition().X,  
				GetOwner()->GetTransform().GetPosition().Y, 
				GetOwner()->GetTransform().GetPosition().Z);
	glEnd();

#ifdef DEBUG_DRAWING
	glBegin( GL_LINES );
	glColor3f( 1.0f, 0.0f, 1.0f );

	Vector3 pB = static_cast<ParticleComponent*>(GetOwner()->GetComponent("Particle"))->GetVelocity().Normalized() * 1.5f;

	glVertex3f( GetOwner()->GetTransform().GetPosition().X,  
				GetOwner()->GetTransform().GetPosition().Y, 
				GetOwner()->GetTransform().GetPosition().Z);
	pB += GetOwner()->GetTransform().GetPosition();
	glVertex3f( pB.X, pB.Y, pB.Z ); 
	glEnd();
#endif	

}